package com.woniu.adapter;

import com.woniu.outlet.mysql.dao.UserCouponDao;
import com.woniu.outlet.mysql.po.UserCoupon;
import com.woniu.outlet.mysql.po.UserCouponExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;

@Component
public class UserCouponAdapter {

    @Autowired
    private UserCouponDao userCouponDao;

    public void insert(UserCoupon userCoupon) {
        userCouponDao.insert(userCoupon);
    }


    public List<UserCoupon> selectByExample(UserCouponExample example) {
        List<UserCoupon> userCoupons = userCouponDao.selectByExample(example);
        return userCoupons;
    }

    public List<UserCoupon> getCouponPay(String current, BigDecimal money, Integer userId) {
        List<UserCoupon> userCoupons = userCouponDao.getCouponPay(current, money, userId);
        return userCoupons;
    }

    public UserCoupon getById(Integer id) {
        UserCoupon userCoupon = userCouponDao.selectByPrimaryKey(id);
        return userCoupon;
    }
}

